import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ConfigService } from '@nestjs/config';
import { ValidationPipe } from '@nestjs/common';
import { StatusCodeInterceptor } from './common/interceptor/statusCode.interceptor';
import { ResultExceptionFilter } from './common/exception/result.filter';
async function bootstrap() {
    const app = await NestFactory.create(AppModule);
    const configService = app.get(ConfigService);
    app.useGlobalPipes(new ValidationPipe({
        transform: true
    }))
    app.useGlobalInterceptors(new StatusCodeInterceptor())
    app.useGlobalFilters(new ResultExceptionFilter())
    await app.listen(configService.get("app.port"));
    console.log(`localhost:${configService.get("app.port")} 已启动`);

}
bootstrap();
